using Furion.DependencyInjection;
using Furion.FriendlyException;

using Microsoft.AspNetCore.Mvc.Filters;

using System.Threading.Tasks;

using Tool;

namespace Abc.Application
{
    /// <summary>
    /// 全局异常
    /// </summary>
    public class LogExceptionHandler : IGlobalExceptionHandler, ISingleton
    {
        public Task OnExceptionAsync(ExceptionContext context)
        {
            AppEx.GetLogger(logFloderName: "GlobalException", retainedFileCountLimit: 20).Error(context.Exception, "全局异常");
            // 写日志

            return Task.CompletedTask;
        }
    }
}